package com.kabigon.tiny.job;

import com.kabigon.tiny.service.DemoService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

import javax.annotation.Resource;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author xu.biao
 * @version v1.0
 * @Package com.kabigon.tiny.job
 * @data 2022/11/5 22:05
 */
@Slf4j
@DisallowConcurrentExecution
public class DemoJob01 extends QuartzJobBean {

    private final AtomicInteger counts = new AtomicInteger();

    @Resource
    private DemoService demoService;

    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        log.info("[executeInternal][定时第｛{}｝次执行，demoService 为（{}）]", counts.incrementAndGet(), demoService);
    }
}
